<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Replace cached inserts with the actual results
 *
 * @param string $results
 * @return string
 */
function smarty_insert_cart_info($params, &$smarty) {
	if( defined('SYS_RT_CACHE_CONTROL') && SYS_RT_CACHE_CONTROL == '1' ) {
		return '0 item(s): $0.00';
	}
	//
	$_SESSION['cart']->calc();
	$count = $_SESSION['cart']->total_count;
	$price = $_SESSION['cart']->total_price;
	$price = number_format($price, 2, '.', ',');
	if( $count == '' ) {
		$count = 0;
	}
	
	$content = '';
	$content .= $count . ' item(s): ';
	$content .= '$' . $price;
	
	return $content;
}
//
?>